package com.an.blog.web.controller;

import cn.dev33.satoken.annotation.SaIgnore;
import com.an.blog.service.IBlogCommentService;
import com.an.blog.web.domain.bo.BlogCommentQueryWebBo;
import com.an.blog.web.domain.vo.BlogCommentWebVo;
import com.an.common.annotation.Log;
import com.an.common.core.controller.BaseController;
import com.an.common.core.domain.R;
import com.an.common.enums.BusinessType;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 博客评论web控制器
 *
 * @author: Ann
 * @createDate: 2023/06/09 07:58:40
 * @version: 1.0.0
 */
@RestController
@RequestMapping("blog-web/comment")
@RequiredArgsConstructor
public class BlogCommentWebController extends BaseController {

    private final IBlogCommentService commentService;

    /**
     * 查询博客评论网站列表
     *
     * @return {@link R }<{@link List }<{@link BlogCommentWebVo }>>
     * @author: Ann
     * @createDate: 2023/06/09 07:59:57
     * @version: 1.0.0
     */
    @SaIgnore
    @GetMapping("/getList")
    public R<List<BlogCommentWebVo>> queryBlogCommentWebList(BlogCommentQueryWebBo commentQueryWebBo){
        return R.ok(commentService.queryWebList(commentQueryWebBo));
    }

    /**
     * 删除评论
     *
     * @param commentId 评论id
     * @return {@link R }<{@link Void }>
     * @author: Ann
     * @createDate: 2023/06/10 17:01:39
     * @version: 1.0.0
     */
    @DeleteMapping("/delete/{commentId}")
    @Log(title = "删除评论", businessType = BusinessType.DELETE)
    public R<Void> deleteCommentOnWeb(@PathVariable Long commentId){
        return toAjax(commentService.deleteCommentOnWeb(commentId));
    }

}
